package com.xunk.equipment.mapper;

import com.xunk.equipment.domain.HomeDO;
import com.xunk.system.api.domain.SysHome;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @ProjectName: xunk
 * @Package: com.xunk.equipment.mapper
 * @ClassName: HomeMapper
 * @Author: yangwendong
 * @Description:
 * @Date: 2021/3/30 10:02
 * @Version: 1.0
 */
public interface HomeMapper {
    Long findDeptIdByOwnId(@Param("ownId") String ownId);

    String findOwnIdByDeptId(@Param("deptId") Long deptId);

    String findAncestorByDeptId(@Param("deptId") Long deptId);

    Long findDeptIdByHomeId(@Param("homeId") Long homeId);

    List<Long> listHomeIdsByUserId(@Param("userId") Long userId);

    HomeDO getHomeById(@Param("homeId") Long homeId);

    HomeDO findMasterHomeByDeptId(@Param("deptId") Long deptId);

    List<Long> listUserIdsByDeptId(@Param("deptId") Long deptId);

    /**
     * 根据家庭id查询户主userid
     *
     * @param homeId
     * @return
     */
    Long findMasterByHomeId(@Param("homeId") Long homeId);

    /**
     * 查询用户与家庭是否存在关系
     *
     * @param homeId
     * @param userId
     * @return
     */
    int selectCountByHomeIdAndUserId(@Param("homeId") Long homeId, @Param("userId") Long userId);
}
